package org.linlinjava.litemall.db.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.linlinjava.litemall.db.models.GrouponRules;

import java.util.List;

public interface GrouponRulesService extends IService<GrouponRules> {

    /**
     * 查询某个商品关联的团购规则
     *
     * @param goodsId
     * @return
     */
    public List<GrouponRules> queryByGoodsId(Long goodsId) ;

    public int countByGoodsId(Long goodsId) ;

    public List<GrouponRules> queryByStatus(Short status) ;

    /**
     * 获取首页团购规则列表
     *
     * @param page
     * @param limit
     * @return
     */
    public IPage<GrouponRules> queryList(Integer page, Integer limit) ;

    /**
     * 判断某个团购规则是否已经过期
     *
     * @return
     */
    public boolean isExpired(GrouponRules rules) ;

    /**
     * 获取团购规则列表
     *
     * @param goodsId
     * @param page
     * @param size
     * @return
     */
    public IPage<GrouponRules> querySelective(String goodsId, Integer page, Integer size) ;
}